package com.atguigu.iterator;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @program: design-patterns
 * @author: yangshen
 * @description: 信息学院
 * @create: 2022-03-07 12:31
 **/
public class InfoCollege implements College{

    List<Department> departmentList;

    public InfoCollege() {
        departmentList = new ArrayList<>();
        addDepartment("信息安全系","信息安全系的");
        addDepartment("网络安全系","网络安全系的");
        addDepartment("服务器安系","服务器安全系的");
    }

    @Override
    public String getName() {
        return "信息工程学院";
    }

    @Override
    public void addDepartment(String name, String desc) {
        Department department = new Department(name, desc);
        departmentList.add(department);
    }

    @Override
    public Iterator createIterator() {
        return new InfoCollegeIterator(departmentList);
    }
}
